package com.itheima.reggie.common;

import com.itheima.reggie.domain.User;

/**
 * @Author fanYuLe
 * @Date 2023/3/8 16:45
 * @Blog blog.fanYuLe.net/996.mba
 * @Description:
 */
//threadLocal操作工具类
public class UserHolder {
    //维护ThreadLocal对象
    private static ThreadLocal<User> threadLocal =new ThreadLocal<>();
    //放入User
    public static void set(User user){
        threadLocal.set(user);
    }
    //获取User
    public static User get(){
        return threadLocal.get();
    }
    //移除user
    public static void remove(){
        threadLocal.remove();
    }
}

